#ifndef PERSON_H
#define PERSON_H

#include <QGraphicsPixmapItem>
#include <QGraphicsScene>
#include <stdlib.h>
#include <QPoint>

#include "gameitems.h"
#include "toolbutton.h"
#include "virus.h"
#include "personstats.h"
#include "pathmap.h"

class Building;     // We needs to do this to avoid a circular declaration problem
class LevelScene;

class Person : public QObject, public QGraphicsPixmapItem
{
    Q_OBJECT

public:
    Person(PathMap * mapper, QPixmap personPixmap, LevelScene * parent, QGraphicsScene * scene);
    Building * getCurrentBuilding();
    void setCurrentBuilding(Building * newBuilding);
    Building * currentBuilding;
    Virus *virus;
    PersonStats *stats;
    void setPath(std::vector<void*> newPath);

    bool isInBuilding();

public slots:
    void treatPerson();
    void advance(int phase);
    void startPerson();
    void stopPerson();

signals:
    void solvePath(QPoint start, QPoint finish, QObject * sender);

protected:
   virtual void collidesWithPerson(Person * colliding);
   void timerEvent(QTimerEvent *);
   void arrive();

private:
   double pathLocation;
   PathMap * pathMap;
   std::vector<void*> path;
   bool inBuilding, isMoving;
   LevelScene * parentScene;
   int timerID;



};

#endif // PERSON_H
